<?php
    /* 2020.6.5
     * 回复后台操作页 
     *@author huangchuting
     *
     * */
    header("Content-type:text/html;charset=utf-8");
    require_once '../inc/reply.php';
    $message="";
    if(isset($_SESSION["CURRENT_USER"]))
    {
        if(isset($_POST["reviewId"]))
        {
            $current_user=$_SESSION["CURRENT_USER"];
            $uId=$current_user["uId"];
            $reviewId=$_POST["reviewId"];
            $content=$_POST["replyContent"];
            $result=addReply($reviewId, $uId, $content);
            if ($result<=0)
            {
                $message="评论发表失败，至于为什么，可能人品问题吧";
            }
            else
            {
                header("location:../style/review.php?reviewId=$reviewId");
                return ;
            } 
        }
        else
        {
            $message="书评不存在，不能发表评论";
        }
    }
    else
    {
        $message="用户未登录，不能发表评论";
    }
    header("location:../style/errorNew.php?message=$message");
?>